package com.Lab427.workflow.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @version 1.0
 * @auther Tian Yunhe
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/ai")
public class TestController {

    private final ChatClient chatClient;

    @RequestMapping(value = "/chat",produces = "text/html;charset=utf-8")
    public Flux<String> chat(){
        return chatClient.prompt()
                .user("小明的妈妈有四个孩子，其中三个分别叫大毛、二毛、三毛。请问第四个孩子叫什么？")
                .stream()
                .content();
    }

}
